﻿using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using HelenServer.UserCenter.Contracts;
using Microsoft.EntityFrameworkCore;

namespace HelenServer.UserCenter.Dal;

[Table("User")]
public partial class User
{
    [Key]
    public int Id { get; set; }

    [StringLength(16)]
    [Unicode(false)]
    public string Username { get; set; } = null!;

    [StringLength(128)]
    [Unicode(false)]
    public string Password { get; set; } = null!;

    public virtual Department? Department { get; set; }

    public virtual Position? Position { get; set; }

    [StringLength(64)]
    [Unicode(false)]
    public string? Avatar { get; set; }

    [StringLength(32)]
    [Unicode(false)]
    public string Name { get; set; } = null!;

    public int? Sex { get; set; }

    [Column(TypeName = "datetime")]
    public DateTime? Birthday { get; set; }

    [StringLength(16)]
    [Unicode(false)]
    public virtual ICollection<Role> Roles { get; set; } = new List<Role>();

    public int? JobNumber { get; set; }

    [Column(TypeName = "datetime")]
    public DateTime? InductionDate { get; set; }

    public UserStatus Status { get; set; }

    [StringLength(32)]
    [Unicode(false)]
    public string? Email { get; set; }

    public int Score { get; set; } = 0;

    [Column("LastIP")]
    [StringLength(16)]
    [Unicode(false)]
    public string? LastIp { get; set; }

    [Column(TypeName = "datetime")]
    public DateTime? LastLoginDate { get; set; }

    public ClientStatus ClientStatus { get; set; }

    public bool Deleted { get; set; } = false;
}